{% extends 'TopxiaWebBundle::bootstrap-modal-layout.html.twig' %}

{% block title %}{% if announcement.id %}编辑{% else %}添加{% endif %}公告{% endblock %}

{% block body %}
  <form id="announcement-write-form" method="post"
    {% if announcement.id %}
      action="{{ path('course_announcement_update',{courseId:course.id, id:announcement.id}) }}"
    {% else %}
      action="{{ path('course_announcement_add',{courseId:course.id}) }}"
    {% endif %}
  >

    <div class="form-group">
      <div class="controls">
        <textarea class="form-control" id="announcement-content-field" name="content" data-display="公告内容" data-image-upload-url="{{ path('editor_upload', {token:upload_token('default')}) }}">{{ announcement.content }}</textarea>
      </div>
    </div>
    {% if not announcement.id %}
    <div class="checkbox">
      <label>
        <input type="checkbox" name="notify" value="notify"> 发送系统通知给该课程的{{ setting('default.user_name', '学员') }}
      </label>
    </div>
    {% endif %}
    <input type="hidden" name="_csrf_token" value="{{ csrf_token('site') }}">

  </form>

  <script>
    app.load('course/announcement-write');
  </script>

{% endblock %}
{% block footer %}
  <button type="button" class="btn btn-link" data-dismiss="modal">取消</button>
  <button type="submit" class="btn btn-primary pull-right" data-toggle="form-submit" data-target="#announcement-write-form">保存</button>
{% endblock %}